<div id="aa" class="easyui-accordion">
    <?php
    sort($modules);
    foreach ($modules as $key => $value) {
        if ($value['name'] == 'pages') {
            continue;
        }
        $selected = "false";
        $currentModuleName = $this->Session->read('currentModuleName');
        if ($currentModuleName == $value['name']) {
            $selected = "true";
        }
        ?>
    <div title='<?php echo $value['name']; ?>' data-options="iconCls:'icon-<?php echo $this->Html->getModuleIcon($value['name']); ?>',selected:<?php echo $selected; ?>" style="padding:0;">


            <div class='menuGeral'>
                <ul id="menuUlAccordion">
                    <?php 
                    if($value['model']){
                        $class = "";
                        if ($this->Session->read('currentMethodName') == 'index' && $currentModuleName == $value['name']) {
                            $class = "active";
                        }
                        ?>
                        <li><a href='<?php echo $this->Html->url(array('controller' => $value['name'], 'action' => 'index')); ?>' class='<?php echo $class;?>' ><div class='icon-application-form' style='padding-left: 18px;'><?php echo __('Cake Form'); ?></div></a></li>
                        <?php
                        $class = "";
                        if ($this->Session->read('currentMethodName') == 'dataGrid' && $currentModuleName == $value['name']) {
                            $class = "active";
                        }
                        ?>
                        <li><a href='<?php echo $this->Html->url(array('controller' => $value['name'], 'action' => 'dataGrid')); ?>' class='<?php echo $class;?>' ><div class='icon-table--arrow' style='padding-left: 18px;'><?php echo __('Data Grid'); ?></div></a></li>

                        <?php
                    
                    }
                    foreach ($value['blocks'] as $file) {
                        if ($file == 'pages') {
                            continue;
                        }
                        $class = "";
                        if ($this->Session->read('currentMethodName') == $file) {
                            $class = "active";
                        }
                        echo "<li class='{$class}' ><a href='{$this->Html->url(array('controller' => $value['name'], 'action' => $file))}'><div class='icon-" . $this->Html->getBlockIcon($value['name'], $file) . "' style='padding-left: 18px;'>".ucwords(str_replace(array("block_", "_"), array("", " "), $file))."</div></a></li>";
                    }
                    ?>
                </ul>
            </div>
        </div>
        <?php
    }
    ?>
</div>
